//
//  ViewController.m
//  WkWebView
//
//  Created by 吴志勇 on 2020/4/7.
//  Copyright © 2020 wzy. All rights reserved.
//

#import "ViewController.h"
#import <WebKit/WebKit.h>

@interface ViewController ()

/* <#注释#> */
@property (nonatomic, weak)WKWebView *webView;

@end

@implementation ViewController


- (WKWebView *)webView{
    if (!_webView) {
        WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectMake(10, 10, ([UIScreen mainScreen].bounds.size.width), 400)];
        [self.view addSubview:webView];
        _webView = webView;
    }
    return  _webView;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    
    WKWebViewConfiguration *webConfiguration = [WKWebViewConfiguration new];
    
    NSString *urlStr = @"https://www.so.com";
    NSURL *url = [NSURL URLWithString:urlStr];
    NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
    [self.webView loadRequest:request];

}

- (IBAction)backClick:(id)sender {
    if ([_webView canGoBack]) {
        [_webView goBack];
    }
    
}
- (IBAction)goClick:(id)sender {
    if ([_webView canGoForward]) {
        [_webView goForward];
    }
}

@end
